/*******************************************************************************
 *
 * Copyright (c) 2008, 2009 Michael Schulze <mschulze@ivs.cs.uni-magdeburg.de>
 * All rights reserved.
 *
 *    Redistribution and use in source and binary forms, with or without
 *    modification, are permitted provided that the following conditions
 *    are met:
 *
 *    * Redistributions of source code must retain the above copyright
 *      notice, this list of conditions and the following disclaimer.
 *
 *    * Redistributions in binary form must reproduce the above copyright
 *      notice, this list of conditions and the following disclaimer in
 *      the documentation and/or other materials provided with the
 *      distribution.
 *
 *    * Neither the name of the copyright holders nor the names of
 *      contributors may be used to endorse or promote products derived
 *      from this software without specific prior written permission.
 *
 *
 *    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
 *    IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 *    TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 *    PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 *    OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 *    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 *    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 *    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 *    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 *    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 *    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 *
 * $Id: loggingConfigAVR.h 1 2010-01-11 14:24:28Z perch $
 *
 ******************************************************************************/

#ifndef __loggingConfigAVR_h__
#define __loggingConfigAVR_h__

#if ! ( defined(CPU_FREQUENCY) || defined(F_CPU) )
#warning CPU_FREQUENCY is not set and the avr-halib will select the default \
         value of 8MHz. If does not correspond to the right micro-controller \
         CPU frequency the logging output will obfuscated.
#endif

#include "avr-halib/avr/uart.h"
#include "avr-halib/share/cdevice.h"
#include "avr-halib/share/cbuffer.h"
#include "avr-halib/share/queuebuffer.h"

#ifndef UARTLOGDEVICE
/*!\brief Predefinition of the uart %device as base output
 *
 * This can be overdefined to switch to other uarts on the underlying
 * %device
 */
#define UARTLOGDEVICE Uart0
#endif

namespace logging {
    /*!\brief The %config namespace separates the configurations of the
     *        %logging framework from the %logging namespace avoiding name
     *        clashes.
     *
     *        It contains different possible configurations for different
     *        platforms, but the configurations are not limited to the yet
     *        provided one.
     */
    namespace config {

        /*!\brief UartLogType is a possible %logging type for the AVR
         *        micro controller.
         *
         *        Here we use our avr-halib that abstracts from some low-level
         *        stuff and allows for easier use of different AVR flavors,
         *        but with always the same interface to the UART.
         */
        typedef ::logging::OutputLevelSwitchDisabled <
                    ::logging::OutputStream <
                        OutputBaseType <
                            COutDevice <
                                SecOut <
                                    Uartnoint <
                                        UARTLOGDEVICE<>
                                    >
                                >
                            >
                        >
                    >
                > UartLogType;
    }

    /*!\brief base logging type for the respective platform
     */
    typedef ::logging::config::UartLogType LoggingType;
}


#endif
